<template>
  <div>
    <div><h1>MUSIC</h1></div>
    <div class="music">
      <div class="item" v-for="item of music" :key="item.id">
        <img :src="item.picUrl" alt="" />
        <div class="music_name">{{ item.name }}</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      music: [],
    };
  },
  mounted() {
    this.$http.get("http://47.108.197.28:3000/top/album").then((res) => {
      this.music = res.data.albums;
    });
  },
};
</script>

<style>
h1{
    text-align: center;
}
.music {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
}
.item {
  margin: 10px;
  width: 100px;
}
.item img {
  width: 100px;
}
.music_name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin: 5px;
}
</style>